import { Component, OnInit } from '@angular/core';
import { NzMessageService, UploadFile } from 'ng-zorro-antd';
import { ApiService } from 'src/app/core/api';
import { MessageService } from 'src/app/core/service/message.service';
import { FormBuilder, Validators } from '@angular/forms';
import { urlService } from './../../../core/api/url';
import { Router, ActivatedRoute } from '@angular/router';
import { DatePipe } from '@angular/common';

@Component({
	templateUrl: './travelAgencyDetail.html',
	providers: [DatePipe],
	styles:[`
	.tour-detail .ant-row[nz-row] nz-form-label.ant-form-item-label{
		width: 125px;
	}
	`]
})
export class TravelAgencyDetailComponent implements OnInit {
	data: any = {};
	id;
	agencyTravelCategoryList = [];
	constructor(private apiService: ApiService, private nzMessageService: NzMessageService, private message: MessageService, private fb: FormBuilder, private router: Router, private datePipe: DatePipe, private activeRouter: ActivatedRoute) {
		this.id = this.activeRouter.snapshot.queryParams['id'];
	}
	ngOnInit() {
		this.message.setBreadcrumb({
			breadcrumbs: [{ name: '机构管理' }],
		});
		if (this.id) {
			this.apiService.post('旅行社详情', { id: this.id }).then((res: any) => {
				this.data = res.data.travelAgencyDetail;
				this.agencyTravelCategoryList = res.data.agencyTravelCategoryList;
				this.data.images = this.data.images.split(',');
			});
		}
	}
}
